﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Model;
using HRP.Utilidades;

namespace HRP.Private.Funcionarios
{
    public partial class Criar : System.Web.UI.Page
    {
        public string moeda
        {
            get
            {
                if (Session["EmpresaActual"] != null)
                {
                    hrp_empresas empresaActual = (hrp_empresas)Session["EmpresaActual"];
                    return utilidades.ObterMoedaEmpresa(empresaActual.id);
                }
                Response.Redirect("/private/logout.aspx");
                return string.Empty;
            }
        }

        private string _Token
        {
            get
            {
                string clienteId = Session["idclient"] != null ? Session["idclient"].ToString() : "";
                if (Session["criarFunc_" + clienteId] != null)
                    return Session["criarFunc_" + Session["idclient"].ToString()].ToString();

                return null;
            }
            set
            {
                string clienteId = Session["idclient"] != null ? Session["idclient"].ToString() : "";
                Session["criarFunc_" + clienteId] = value;
            }
        }
        public string Token
        {
            get
            {
                return _Token;
            }
            set
            {
                _Token = value;
            }

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (!string.IsNullOrEmpty(Token))
                {
                    Session.Remove("CriarDadosFuncionarioTemp_" + Token);
                    Session.Remove("CriarContratoFuncionarioTemp_" + Token);
                }
                Token = Guid.NewGuid().ToString();
            }
            wizardForm.Visible = true;
            msgPanel.Visible = !wizardForm.Visible;
            errorPanel.Visible = !wizardForm.Visible;
        }

    }
}